﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.Text;


namespace YLPublicService.TransferModel
{
    [DataContract]
    public class WorkItem
    {
        public WorkItem()
        {
            DBTime = DateTime.Now;
            Status = WorkItemStatus.New;
        }
        [DataMember]
        public int WorkItemID { get; set; }
        [DataMember]
        public int TemplateID { get; set; }
        [DataMember]
        public string TemplateName { get; set; }
        [DataMember]
        public string Detial { get; set; }
        [DataMember]
        public WorkItemStatus Status { get; set; }
        /// <summary>
        /// 记录添加时间
        /// </summary>
        [DataMember]
        public DateTime DBTime { get; set; }

        private string discription;
        public string GetDiscription()
        {
            if (discription == string.Empty)
            {
                var DetialObject = TemplateItem.TemplateDetial.FromXML(Detial);
                StringBuilder sb = new StringBuilder();
                sb.Append(WorkItemID.ToString());
                var x = from rv in DetialObject.mRequireValues.mItem
                        select rv.mValue;
                foreach (var item in x)
                {
                    sb.Append(item + " ");
                }
                discription = sb.ToString();
            }
            return discription;
        }
    }
}